home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
NeXT Education Software Sampler 1992 Fall
/
NeXT Education Software Sampler 1992 Fall.iso
/
Programming
/
Source
/
WAIS
/
lib
/
trunc.c
< prev
Encoding:
Amiga
Atari
Commodore
DOS
FM Towns/JPY
Macintosh
Macintosh JP
Macintosh to JP
NeXTSTEP
RISC OS/Acorn
Shift JIS
UTF-8
Wrap
C/C++ Source or Header
|
1992-02-02
|
365 b
|
26 lines
#include <stdio.h>
main(argc, argv)
int argc;
char **argv;
{
int len, i, c;
if (argc != 2) {
fprintf(stderr, "Usage: %s length\n", argv[0]);
exit(-1);
}
len = atoi(argv[1]);
i = 0;
while (EOF != (c = getchar())) {
if (c == '\n') {
putchar(c);
fflush(stdout);
i = 0;
}
else if (i++ < len)
putchar(c);
}
}